import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
      ),
      //Scrollbar和SingleChildScrollView结合使用可以生成可滚动区域
      /*body: Scrollbar(
        child: SingleChildScrollView(
          child: Container(
            height: 3000,
            color: Colors.red,
          ),
        ),
      )*/
      /*body: Column(
        children: <Widget>[
          ListTile(title: Text("固定的表头")),
          Container(
            height: 400,
            child: ListView.builder(
                //一共有多少个元素
                itemCount: 50,
                //每个元素高度50
                itemExtent: 50,
                itemBuilder: (BuildContext context,int index){
                  return Text("列表内容$index");
                }),
          )

        ],
      ),*/
      body: GridView(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          //横向有三格
          crossAxisCount: 3,
          childAspectRatio: 1
        ),
        children: <Widget>[
          Text("1"),
          Text("2"),
          Text("3"),
          Text("4"),
          Text("5"),
          Text("6"),
          Text("7"),
          Text("8"),
          Text("9"),
          Text("1"),
          Text("1"),
          Text("1"),
          Text("1"),
        ],
      ),
    );
  }

}
